#ifndef _CORE_H_INCLUDED_
#define _CORE_H_INCLUDED_
#include "epollEngine.h"
#include "log.h"
#include "connection.h"
#include "threadPool.h"
#include <queue>
#include <mutex>
#include <vector>
#include <sys/sysinfo.h>
const int num_of_cpus = get_nprocs();
const int max_buffer_size = 2048;

struct core_data_t{
    epollEngine epoll;
    Socket serverSocket;
    MyLogger logger;
    connectionPool connections;
    char buffer[max_buffer_size];
    threadPool workers;
    core_data_t(int serverSocket):
    epoll(),serverSocket(serverSocket,SERVER_SOCKET),logger(),connections(),buffer(),workers(num_of_cpus)
    {}
    core_data_t() = delete;
};

/**
 * @return 1：已经发送完 0：需要再次发送 -1：发送失败
 * */
int echo(string data, connection_t* conn, core_data_t& core_data);

#endif